<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resource/bootstrap4/css/bootstrap.css">
    <script src="${pageContext.request.contextPath}/resource/js/jquery-3.2.1.js"></script>
    <script src="${pageContext.request.contextPath}/resource/bootstrap-treeview/js/bootstrap-treeview.js"></script>
    <script src="${pageContext.request.contextPath}/resource/bootstrap4/js/bootstrap.js"></script>
    <script src="${pageContext.request.contextPath}/resource/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
    <form>
        姓名：<input name="name">
        <br>
        求职意向：
        <c:forEach items="${DESIRE}" var="d" varStatus="i">
            ${d.name}<input type='checkbox' class='desire-id' name='desires[${i.index}].id' value='${d.id}'>
        </c:forEach>
        <br>
        出生日期：<input name="birthday" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})">
        <br>
        学历：<select name="education.id"><option value="0">请选择</option></select>
        <br>
        性别：
        <c:forEach items="${genders}" var="g">
            ${g.gender}<input type="radio" name="gender" value="${g}">
        </c:forEach>
        <br>
        简历信息：<input type="text" name="text">
        <br>
    </form>
    <button type="button" onclick="sub()">提交</button>
    <script>
        $(function () {
            for (let temp of ${educations}){
                $("[name='education.id']").append("<option value='"+temp.id+"'>"+temp.education+"</option>");
            }
        });

        function sub() {
            $.post("${pageContext.request.contextPath}/resume/insert",$("form").serialize(),function (result) {
                if (result > 0){
                    alert("添加成功");
                    location = "${pageContext.request.contextPath}/resume/list";
                }else {
                    alert("请勿重复提交");
                }
            });
        }
    </script>
</body>
</html>
